This repository was archived by the owner on Jun 12, 2026. It is now read-only.
fix: clamp changeInitialSatoshis to minimum of 1 - #147
Merged
Conversation
When a basket's minimumDesiredUTXOValue is 0 (e.g. from corrupted remote storage config), all createAction calls fail validation. This matches the existing Math.max(1, ...) pattern already used for changeFirstSatoshis on the next line. Fixes bsv-blockchain/bsv-desktop#32 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
tonesnotes
approved these changes
Apr 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
changeInitialSatoshistoMath.max(1, ...)increateAction.ts, matching the existing pattern used forchangeFirstSatoshison the next line.createActioncalls from failing when a basket'sminimumDesiredUTXOValueis 0 (e.g. from corrupted or legacy remote storage config).Context
When using remote storage (e.g.
storage.babbage.systems), thedefaultbasket'sminimumDesiredUTXOValuecan end up as0. This flows directly intochangeInitialSatoshis, which then failsvalidateSatoshis(..., 1)ingenerateChange.ts— blocking every transaction even when the wallet has funds.Previously users had to manually reset basket params via a diagnostic tool in bsv-desktop. This one-line fix makes that unnecessary.
Fixes bsv-blockchain/bsv-desktop#32
Test plan
createActionsucceeds when basket hasminimumDesiredUTXOValue: 0minimumDesiredUTXOValue >= 1🤖 Generated with Claude Code